name: Step 1, Create a branch

on:
  workflow_dispatch:
  create:

permissions:
  contents: write

jobs:
  get_current_step:
    name: Check current step number
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - id: get_step
        run: |
          echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT
    outputs:
      current_step: ${{ steps.get_step.outputs.current_step }}

  on_create_a_branch:
    name: On create a branch
    needs: get_current_step

    if: >-
      ${{ needs.get_current_step.outputs.current_step == 1
          && github.ref_type == 'branch'
          && github.ref_name == 'my-first-branch' }}

    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0 # Let's get all the branches.